{template '_header'}
<div class="page-header">
    当前位置：<span class="text-primary"> 基础设置</span>
</div>

<div class="page-content">
    <form id="setform"  {ifp 'identity.set.edit'}action="" method="post"{/if} class="form-horizontal form-validate">

        <input type="hidden" id="tab" name="tab" value="#tab_basic" />
        <div class="tabs-container">
             <ul class="nav nav-tabs" id="myTab">
                <li {if empty($_GPC['tab']) || $_GPC['tab']=='basic'}class="active"{/if}><a href="#tab_basic">基本</a></li>
            </ul>
            <div class="tab-content ">
                <div class="form-group">
                    <label class="col-lg control-label">是否开启身份升级</label>
                    <div class="col-sm-7">
                        <input type="hidden" name="id" value="{$item['id']}">
                        {ifp 'identity.set.edit'}
                        <label class="radio-inline"><input type="radio"  name="is_use_identity" value="1" {if $item['is_use_identity'] ==1} checked="checked"{/if} /> 开启</label>
                        <label class="radio-inline"><input type="radio"  name="is_use_identity" value="0" {if $item['is_use_identity'] ==0} checked="checked"{/if} /> 不开启</label>
                        <div class='help-block'></div>
                        {/if}
                    </div>
                </div>
            </div>
        </div>

        <div class="tabs-container">
            <ul class="nav nav-tabs" id="myTab">
                <li {if empty($_GPC['tab']) || $_GPC['tab']=='basic'}class="active"{/if}><a href="#tab_basic">菜单</a></li>
            </ul>
            <div class="tab-content ">
                <div class="form-group">
                    <label class="col-lg control-label">是否使用门店菜单</label>
                    <div class="col-sm-7">
                        {ifp 'identity.set.edit'}
                        <label class="radio-inline"><input type="radio"  name="is_use_mendian_member" value="1" {if $item['is_use_mendian_member'] ==1} checked="checked"{/if} /> 使用</label>
                        <label class="radio-inline"><input type="radio"  name="is_use_mendian_member" value="0" {if $item['is_use_mendian_member'] ==0} checked="checked"{/if} /> 不使用</label>
                        <div class='help-block'></div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg control-label">是否使用会员菜单</label>
                    <div class="col-sm-7">
                        {ifp 'identity.set.edit'}
                        <label class="radio-inline"><input type="radio"  name="is_use_member" value="1" {if $item['is_use_member'] ==1} checked="checked"{/if} /> 使用</label>
                        <label class="radio-inline"><input type="radio"  name="is_use_member" value="0" {if $item['is_use_member'] ==0} checked="checked"{/if} /> 不使用</label>
                        <div class='help-block'></div>
                        {/if}
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg control-label">是否使用订单栏</label>
                    <div class="col-sm-7">
                        {ifp 'identity.set.edit'}
                        <label class="radio-inline"><input type="radio"  name="is_use_order" value="1" {if $item['is_use_order'] ==1} checked="checked"{/if} /> 使用</label>
                        <label class="radio-inline"><input type="radio"  name="is_use_order" value="0" {if $item['is_use_order'] ==0} checked="checked"{/if} /> 不使用</label>
                        <div class='help-block'></div>
                        {/if}
                    </div>
                </div>



                
            </div>
        </div>

        <div class="tabs-container">
            <ul class="nav nav-tabs" id="myTab">
                <li {if empty($_GPC['tab']) || $_GPC['tab']=='basic'}class="active"{/if}><a href="#tab_basic">订单页设置</a></li>
            </ul>
            <div class="tab-content ">

                <div class="form-group">
                    <label class="col-lg control-label">是否显示门店信息</label>
                    <div class="col-sm-7">
                        <label class="radio-inline">
                            <input type="radio" name='is_show_mendian_info' value="1" {if $item['is_show_mendian_info']==1}checked{/if} /> 启用
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name='is_show_mendian_info' value="0" {if empty($item['is_show_mendian_info'])}checked{/if}/> 不启用
                        </label>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg control-label">是否启用身份购买人本人身份限制功能</label>
                    <div class="col-sm-7">
                        {ifp 'identity.set.edit'}
                        <label class="radio-inline"><input type="radio"  name="is_use_self_condition" value="1" {if $item['is_use_self_condition'] ==1} checked="checked"{/if} /> 使用</label>
                        <label class="radio-inline"><input type="radio"  name="is_use_self_condition" value="0" {if $item['is_use_self_condition'] ==0} checked="checked"{/if} /> 不使用</label>
                        <div class='help-block'></div>
                        {/if}
                    </div>
                </div>
                <div class="form-group">
                    <label class=" control-label col-lg">是否启用上一级身份购买权限限制</label>
                    <div class="col-sm-7">
                        <label class="radio-inline">
                            <input type="radio" name='is_use_buy_condition' value="1" {if $item['is_use_buy_condition']==1}checked{/if}  onclick="idedshow('buy_condition1')"/> 启用
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name='is_use_buy_condition' value="0" {if empty($item['is_use_buy_condition'])}checked{/if} onclick="idedhide('buy_condition1')"/> 不启用
                        </label>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-lg control-label">升级身份列表显示方式</label>
                    <div class="col-sm-7">
                        {ifp 'identity.set.edit'}
                        <label class="radio-inline"><input type="radio"  name="show_type" value="1" {if $item['show_type'] ==1} checked="checked"{/if} /> 身份商品列表（带缩略图）</label>
                        <label class="radio-inline"><input type="radio"  name="show_type" value="2" {if $item['show_type'] ==2} checked="checked"{/if} /> 身份简称列表</label>
                        {/if}
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-lg control-label">身份协议</label>
                    <div class="col-sm-9 col-xs-12" >
                        <textarea cols="80" rows="10" name="identity_agreement">{$item['identity_agreement']}</textarea>
                    </div>
                </div>
                
            </div>
        </div>
    {ifp 'identity.set.edit'}
        <div class="form-group">
            <label class="col-lg control-label"></label>
            <div class="col-sm-9 col-xs-12">
                <input type="submit"  value="提交" class="btn btn-primary" />
            </div>
        </div>
    {/if}

    </form>
</div>
<script language='javascript'>
        require(['bootstrap'], function () {
            $('#myTab a').click(function (e) {
                $('#tab').val($(this).attr('href'));
                e.preventDefault();
                $(this).tab('show');
            })
        });

        $(function () {
            $('.open_apply').click(function () {
                var type = $(".open_apply:checked").val();
                if (type == '1') {
                    $('.protocol-group').show();
                } else {
                    $('.protocol-group').hide();
                }
            })
        });

</script>
<script type="text/javascript">
    function idedshow(obj){
        console.log(obj);
        $("#"+obj).attr('style', 'display:block;');
        if(obj == 'buy_condition1'){
            $.ajax({
                type: "POST",
                url: "{php echo webUrl('identity/set/get_identity')}",
                data: {levelnum: $('#levelnum').val()},
                dataType: "json",
                success: function (data) {
                    var result = data.result.identity;
                    var html = '';
                    for (var i = 0; i < result.length; i++) {
                        html += "<div class='form-group' id='buy_condition'><label class='col-lg control-label'>上一级身份是<strong style='color:red;'>"+result[i]['name']+"</strong><br>购买权限</label><div class='col-sm-7' id='buy_condition1'>";
                        for (var j = 0; j < result.length; j++) {
                            html += ' <input type="checkbox" name="up_buy_condition['+result[i]['id']+'][]" value="'+result[j]['id']+'"> '+result[j]['name']; 
                        }
                        
                        html += "</div></div>";
                    }
                    console.log()
                    $('#buy_condition1').html(html);
                }
            });
        }
    }
    function idedhide(obj){
        $("#"+obj).attr('style', 'display:none;');
    }
</script>
{template '_footer'}
<!--OTEzNzAyMDIzNTAzMjQyOTE0-->